package com.tarena.vehicle.management.converter;

import com.tarena.vehicle.management.pojo.entity.VehicleInsurance;
import com.tarena.vehicle.management.pojo.param.VehicleInsuranceAddNewParam;
import com.tarena.vehicle.management.pojo.param.VehicleInsuranceUpdateParam;
import com.tarena.vehicle.management.pojo.query.VehicleInsuranceQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@Component
public class VehicleInsuranceConverter {

    public VehicleInsurance param2po(VehicleInsuranceAddNewParam param) {
        VehicleInsurance vehicleInsurance = new VehicleInsurance();
        BeanUtils.copyProperties(param,vehicleInsurance);
        vehicleInsurance=setUserMessage(vehicleInsurance);
        return vehicleInsurance;
    }

    public VehicleInsurance param2po(VehicleInsuranceUpdateParam param) {
        VehicleInsurance vehicleInsurance = new VehicleInsurance();
        BeanUtils.copyProperties(param,vehicleInsurance);
        vehicleInsurance=setUserMessage(vehicleInsurance);
        return vehicleInsurance;
    }

    public VehicleInsurance query2po(VehicleInsuranceQuery query) {
        VehicleInsurance vehicleInsurance = new VehicleInsurance();
        BeanUtils.copyProperties(query,vehicleInsurance);
        vehicleInsurance=setUserMessage(vehicleInsurance);
        return vehicleInsurance;
    }

    public VehicleInsurance setUserMessage(VehicleInsurance vehicleInsurance){
        vehicleInsurance.setUid(1);
        vehicleInsurance.setOrgid(1);
        vehicleInsurance.setCompanyCode("JSDTN2210");
        return vehicleInsurance;
    }


}
